package Impor;

import java.util.List;

import dao.BaseDao;
import entity.Category;
import entity.News;
import dao.NewsDao;
/**
 * 新闻实现类
 * @author key1032722147
 *
 */
public class NewsIndexImpor extends BaseDao implements NewsDao{
	
	BaseDao bd = new BaseDao();
	@Override
	//指定类别查看新闻表
	public List<News> sidebar(int i) {
		String sql ="select * from news where cate_id=" + i;
		List<News> list = bd.findNews(sql);
		return list;
	}
	//按序号查看新闻表
		public List<News> findAllNews() {
			String sql ="select * from news order by id desc limit 20" ;
			List<News> list = bd.findNews(sql);
			return list;
		}
	//新闻分类表
	@Override
	public List<Category> getAllNews()  {
		String sql ="select * from category";
		List<Category> list = bd.getNews(sql);
		return list;
	}
}
